import { createRouter, createWebHashHistory } from 'vue-router'
import Article from '@/pages/Article/Article.vue'
import CaseList from '@/pages/CaseList/CaseList.vue'
import Home from '@/pages/Home/Home.vue'
import Login from '@/pages/Login.vue'
import Assistant from '@/pages/Assistant.vue'

const adminRoutes = [
    { path: '/admin', component: () => import('@/pages/admin/Home.vue') },
    { path: '/admin/user', component: () => import('@/pages/admin/User.vue') },
    {
        path: '/admin/article',
        component: () => import('@/pages/admin/Article/Article.vue'),
    },
    {
        path: '/admin/article/edit/:id',
        component: () => import('@/pages/admin/Article/ArticleEdit.vue'),
    },
    {
        path: '/admin/comments/article',
        component: () => import('@/pages/admin/Comments/CommentsArticle.vue'),
    },
    {
        path: '/admin/comments/teach-case',
        component: () => import('@/pages/admin/Comments/CommentsTeachCase.vue'),
    },
    {
        path: '/admin/teach-case',
        component: () => import('@/pages/admin/TeachCase/TeachCase.vue'),
    },
    {
        path: '/admin/teach-case/edit/:id',
        component: () => import('@/pages/admin/TeachCase/TeachCaseEdit.vue'),
    },
    {
        path: '/admin/question',
        component: () => import('@/pages/admin/Question.vue'),
    },
    {
        path: '/admin/knowledge-base',
        component: () =>
            import('@/pages/admin/KnowledgeBase/KnowledgeBase.vue'),
    },
    {
        path: '/admin/knowledge-base/:id/file',
        component: () =>
            import('@/pages/admin/KnowledgeBase/KnowledgeBaseFile.vue'),
    },
    {
        path: '/admin/knowledge-base/:id/file/upload',
        component: () =>
            import('@/pages/admin/KnowledgeBase/KnowledgeBaseFileUpload.vue'),
    },
    {
        path: '/admin/big-model-config',
        component: () => import('@/pages/admin/BigModelConfig.vue'),
    },
    {
        path: '/admin/site-config',
        component: () => import('@/pages/admin/SiteConfig/SiteConfig.vue'),
    },
]

const routes = [
    {
        path: '/',
        component: Home,
        meta: {
            isFullPage: true,
        },
    },
    {
        path: '/login',
        component: Login,
        meta: {
            isFullPage: true,
        },
    },
    { path: '/case-list', component: CaseList },
    { path: '/article', component: Article },
    {
        path: '/article-edit/:id',
        component: () => import('@/pages/admin/Article/ArticleEdit.vue'),
    },
    {
        path: '/article/:id',
        component: () => import('@/pages/Article/ArticleDetail.vue'),
    },
    { path: '/case/:name', component: () => import('@/pages/Case.vue') },
    {
        path: '/assistant',
        component: Assistant,
        meta: {
            isFullPage: true,
        },
    },
    {
        path: '/board',
        component: () => import('@/pages/Board/Board.vue'),
        meta: {
            isFullPage: true,
        },
    },
    ...adminRoutes,
]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
})

export default router
